﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeRefactoring
{
    class Program
    {
        public void PrintStatistics(double[] values, int valuesQuantity)
        {
            PrintMaxValue(values, valuesQuantity);
            PrintMinValue(values, valuesQuantity);
            PrintAverageValue(values, valuesQuantity);
        }

        public double FindMaxValue(double[] values, int valuesQuantity)
        {
            double maxValue = 0;

            for (int i = 0; i < valuesQuantity; i++)
            {
                if (values[i] > maxValue)
                {
                    maxValue = values[i];
                }
            }

            return maxValue;
        }

        public void PrintMaxValue(double[] values, int valuesQuantity)
        {
            double maxValue = FindMaxValue(values, valuesQuantity);
            Console.WriteLine("Max value is: {0}", maxValue);
        }

        public double FindMinValue(double[] values, int valuesQuantity)
        {
            double minValue = 0;

            for (int i = 0; i < valuesQuantity; i++)
            {
                if (values[i] < minValue)
                {
                    minValue = values[i];
                }
            }

            return minValue;
        }

        public void PrintMinValue(double[] values, int valuesQuantity)
        {
            double minValue = FindMinValue(values, valuesQuantity);
            Console.WriteLine("Min value is: {0}", minValue);
        }

        public double FindAverageValue(double[] values, int valuesQuantity)
        {
            double averageValue = 0;
            double sumOfValues = 0;

            for (int i = 0; i < valuesQuantity; i++)
            {
                sumOfValues += values[i];
            }

            averageValue = (sumOfValues / valuesQuantity);
            return averageValue;
        }

        public void PrintAverageValue(double[] values, int valuesQuantity)
        {
            double averageValue = FindAverageValue(values, valuesQuantity);
            Console.WriteLine("Average value is: {0}", averageValue);
        }

        static void Main(string[] args)
        {


        }
    }
}
